<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();

        // 每天中午12点自动生成下一工作日的当班班长
        $schedule->command('checkin:schedule auto-generate-duty')
                 ->dailyAt('12:00')
                 ->description('自动生成下一工作日当班班长');

        // 每5分钟处理一次待发送的通知队列
        $schedule->command('checkin:schedule process-notifications')
                 ->everyFiveMinutes()
                 ->description('处理待发送的通知队列');

        // 每天早上8点发送当日提醒
        $schedule->command('checkin:schedule send-reminder')
                 ->dailyAt('08:00')
                 ->description('发送每日签到提醒');
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
